Rails.application.routes.draw do
  resources :images
  root :to => 'home#index'
  get "/mobile" => "home#mobile"
  get "/robots.txt" => "home#robots"
  get "/admin" => "home#admin"

  get "/ios_functions" => "home#ios_functions"
  get "/ios_models" => "home#ios_models"

  get "/mobile_app" => "home#mobile_app"

  post 'home/smscode'
  get '/credit_records_count' => 'home#credit_records_count'


  get "/home/about_us" => "home#about_us", as: :show_about_us
  get "/home/service_term" => "home#service_term", as: :show_service_term
  get "/home/contact_us" => "home#contact_us", as: :show_contact_us

  namespace :users do
    get '/' =>'users#index'
    get '/forgot'  => 'users#forgot', as: :forgot_password
    get '/:id/show' => 'users#show', as: :show_user
    put '/:id/certify' => 'users#certify', as: :certify
    put '/:id/comfirm_individual' => 'users#comfirm_individual', as: :comfirm_individual
    put '/:id/comfirm_company' => 'users#comfirm_company', as: :comfirm_company
    put '/:id/reject' => 'users#reject', as: :reject
  end

  get "/manage/credit_records" => "manage#credit_records", as: :user_credit_records
  get "/manage/profile" => "manage#profile", as: :user_profile
  put "/manage/profile" => "manage#update_profile", as: :update_profile
  get "/manage/modify" => "manage#modify", as: :user_profile_modify
  put "/manage/certify" => "manage#certify", as: :user_profile_certify
  get "/manage/user" => "manage#show", as: :user_info


  get "/reported" => "home#reported"
  get "/search" => "home#find_credit_records", as: :search_credit_record

  get "/news" => "home#list_article", as: :list_article
  get "/news/:id" => "home#article", as: :show_article

  post "/credit_records/report" => "credit_records#report", as: :credit_record_report
  post "/credit_records/:id/evidences" => "credit_records#upload_evidences", as: :upload_evidences

  #get "/admins" => "admins/sessions#new"

  put "/credit_records/:id/approve" => "credit_records#record_approve", as: :record_approve
  put "/credit_records/:id/reject" => "credit_records#record_reject", as: :record_reject

  get "/configs/about_us" => "configs#about_us", as: :about_us
  get "/configs/service_term" => "configs#service_term", as: :service_term
  get "/configs/contact_us" => "configs#contact_us", as: :contact_us
  get "/configs/mobile_download_qr" => "configs#mobile_download_qr", as: :mobile_download_qr
  get "/configs/weixin" => "configs#weixin", as: :weixin_qr
  get "/configs/login_ad" => "configs#login_ad", as: :login_ad
  get "/configs/password" => "configs#password", as: :admin_change_password
  put "/configs/password" => "configs#update_password"
  # get "/configs/android_apk" => "configs#android_apk", as: :upload_apk


  get "/traffic_violations/search" => "traffic_violations#search", as: :search_violation
  resources :traffic_violations
  resources :cars
  resources :configs
  resources :credit_records
  resources :articles

  devise_for :users, :controllers => {  :registrations => 'users/registrations',
                                        :sessions => 'users/sessions',
                                        :passwords => 'users/passwords' }
                                        
  devise_for :admins, :controllers => { :registrations => 'admins/registrations',
                                        :sessions => 'admins/sessions',
                                        :passwords => 'admins/passwords' }
  # The priority is based upon order of creation: first created -> highest priority.
  # See how all your routes lay out with "rake routes".

  # You can have the root of your site routed with "root"
  # root 'welcome#index'

  # Example of regular route:
  #   get 'products/:id' => 'catalog#view'

  # Example of named route that can be invoked with purchase_url(id: product.id)
  #   get 'products/:id/purchase' => 'catalog#purchase', as: :purchase

  # Example resource route (maps HTTP verbs to controller actions automatically):
  #   resources :products

  # Example resource route with options:
  #   resources :products do
  #     member do
  #       get 'short'
  #       post 'toggle'
  #     end
  #
  #     collection do
  #       get 'sold'
  #     end
  #   end

  # Example resource route with sub-resources:
  #   resources :products do
  #     resources :comments, :sales
  #     resource :seller
  #   end

  # Example resource route with more complex sub-resources:
  #   resources :products do
  #     resources :comments
  #     resources :sales do
  #       get 'recent', on: :collection
  #     end
  #   end

  # Example resource route with concerns:
  #   concern :toggleable do
  #     post 'toggle'
  #   end
  #   resources :posts, concerns: :toggleable
  #   resources :photos, concerns: :toggleable

  # Example resource route within a namespace:
  #   namespace :admin do
  #     # Directs /admin/products/* to Admin::ProductsController
  #     # (app/controllers/admin/products_controller.rb)
  #     resources :products
  #   end
end
